function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
import { CheckCircleFilled, CloseCircleFilled, ExclamationCircleFilled } from '@ant-design/icons';
import { Table } from "../../../functionalComponent";
import { cssVar, Layout, iup, useRefs } from "../../../util";
import { jsx as _jsx } from "react/jsx-runtime";
import { jsxs as _jsxs } from "react/jsx-runtime";
var columns = [{
  dataIndex: 'retFlag',
  title: '校验结果',
  width: 100,
  render: function render(_ref) {
    var value = _ref.value;
    return /*#__PURE__*/_jsxs("span", {
      children: [value === 'forbid' && /*#__PURE__*/_jsxs("span", {
        children: [/*#__PURE__*/_jsx(CloseCircleFilled, {
          style: {
            color: 'red'
          }
        }), " \u4E0D\u901A\u8FC7"]
      }), value === 'prompt' && /*#__PURE__*/_jsxs("span", {
        children: [/*#__PURE__*/_jsx(ExclamationCircleFilled, {
          style: {
            color: 'orange'
          }
        }), " \u6709\u98CE\u9669\u901A\u8FC7"]
      }), value === 'ignore' && /*#__PURE__*/_jsxs("span", {
        children: [/*#__PURE__*/_jsx(CheckCircleFilled, {
          style: {
            color: 'green'
          }
        }), " \u901A\u8FC7"]
      })]
    });
  }
}, {
  dataIndex: 'ruleName',
  title: '业务规则名称',
  width: 150
}, {
  dataIndex: 'ruleContent',
  title: '触发规则',
  tooltip: true,
  flex: 1
}, {
  dataIndex: 'retTip',
  title: '提示信息',
  tooltip: 'render',
  flex: 1,
  render: function render(_ref2) {
    var value = _ref2.value,
      row = _ref2.row;
    if (row.retFlag === 'forbid') {
      var _row$retExtUrls;
      var relateBusinessContent = row === null || row === void 0 || (_row$retExtUrls = row.retExtUrls) === null || _row$retExtUrls === void 0 ? void 0 : _row$retExtUrls.map(function (item, index) {
        return /*#__PURE__*/_jsxs("a", {
          style: {
            marginRight: 10
          },
          onClick: function onClick() {
            iup.open(item.url);
          },
          children: [item.name, " ", index < row.retExtUrls.length - 1 && ';']
        }, index);
      });
      return /*#__PURE__*/_jsxs("div", {
        children: [value, " ", /*#__PURE__*/_jsx("br", {}), relateBusinessContent]
      });
    } else if (row.retFlag === 'prompt') {
      return value;
    } else {
      return;
    }
  }
}];
export function ShowCheckRuleInfo(_ref3) {
  var dataSource = _ref3.dataSource;
  var _useRefs = useRefs(),
    _useRefs2 = _slicedToArray(_useRefs, 1),
    getRef = _useRefs2[0];
  return /*#__PURE__*/_jsx(Layout, {
    direction: "column",
    autoFit: true,
    style: {
      padding: 5
    },
    children: /*#__PURE__*/_jsx(Layout.Flex, {
      style: {
        border: cssVar.border,
        borderRadius: 4
      },
      children: /*#__PURE__*/_jsx(Table, {
        columns: columns,
        ref: getRef('table'),
        dataSource: dataSource,
        rowHeight: 50
      })
    })
  });
}